import csv
with open('data.csv','w') as csvfile:
    #delimiter=' ' 分割符为空格 默认为逗号
    writer = csv.writer(csvfile,delimiter=' ')
    writer.writerow(['id','name','age'])
    writer.writerow(['10001','Mike',20])
    writer.writerow(['10002','Bob',23])
    writer.writerow(['10003','Jordan',24])
